angular.module('baiduNavi',[])
  .factory('$navi',function($q){
    return {
      startNavi: function (pointsInfo) {
        var q = $q.defer();
        somai.baidu.startNavi(pointsInfo, function (success) {
          q.resolve(success);
        }, function (error) {
          q.reject(error);
        })
        return q.promise;
      },
      simulateNavi: function () {
        var q = $q.defer();
        somai.baidu.simulateNavi(function (success) {
          q.resolve(success);
        }, function (error) {
          q.reject(error);
        })
        return q.promise;
      }
    }
  })
